package com.school.admin.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @program: backstage-admin
 * @description: 系统配置
 * @author: sunpx
 * @create: 2022-04-21 20:15
 **/
@Configuration
public class SystemConfig {

    /**
     * 系统名称
     */
    public static String systemName;

    /**
     * 是否参数加密
     */
    public static boolean isParameterEncryption;

    /**
     * 是否判断接口权限
     */
    public static boolean interfaceAuthentication;

    /**
     * 过滤地址
     */
    public static String filterAddresses;

    /**
     * 是否唯一登录
     */
    public static boolean uniqueLogin;

    public static Long loginExpirationTime;

    public static Long passwordTargetWaitingTime;

    public static int allowPasswordMistake;



    /**
     * 是否邮箱验证
     */
    public static boolean mailVerification;

    @Value("${top.sunpxit.system.loginExpirationTime}")
    public  void setLoginExpirationTime(Long loginExpirationTime) {
        SystemConfig.loginExpirationTime = loginExpirationTime;
    }

    @Value("${top.sunpxit.system.password_target_waiting_time}")
    public void setPasswordTargetWaitingTime(Long passwordTargetWaitingTime) {
        SystemConfig.passwordTargetWaitingTime = passwordTargetWaitingTime;
    }

    @Value("${top.sunpxit.system.allow_password_mistake}")
    public void setAllowPasswordMistake(int allowPasswordMistake) {
        SystemConfig.allowPasswordMistake = allowPasswordMistake;
    }

    @Value("${top.sunpxit.system.interfaceAuthentication}")
    public  void setInterfaceAuthentication(String interfaceAuthentication) {
        SystemConfig.interfaceAuthentication = "true".equals(interfaceAuthentication);
    }
    @Value("${top.sunpxit.system.filterAddresses}")
    public  void setFilterAddresses(String filterAddresses) {
        SystemConfig.filterAddresses = filterAddresses;
    }
    @Value("${top.sunpxit.system.isParameterEncryption}")
    public  void setIsParameterEncryption(String isParameterEncryption) {
        SystemConfig.isParameterEncryption = "true".equals(isParameterEncryption);
    }
    @Value("${top.sunpxit.system.uniqueLogin}")
    public  void setUniqueLogin(String uniqueLogin) {
        SystemConfig.uniqueLogin = "true".equals(uniqueLogin);
    }
    @Value("${top.sunpxit.system.systemName}")
    public  void setSystemName(String systemName) {
        SystemConfig.systemName = systemName;
    }
    @Value("${top.sunpxit.system.mailVerification}")
    public  void setMailVerification(String mailVerification) {
        SystemConfig.mailVerification = "true".equals(mailVerification);

    }
}
